import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Clase que crea todos los objetos y sus posiciones para el mundo 4
 * 
 * @author Oliverio Celestino Ochoa
 * @version 1.0
 */
public class Nivel4 extends SWorld
{
    private int cajax;
    private int cajay;
    /**
     * Constructor for objects of class Nivel4.
     * 
     */
    public Nivel4()
    {    
         super(700, 500, 1, 8000); 
 
         GreenfootImage bg = new GreenfootImage("mundo4.jpg");
         setScrollingBackground(bg);
         setMainActor(new Robot(), 0, 0);
         mainActor.setLocation(10, 420);
        
         cajax = Greenfoot.getRandomNumber( 8000 );
         cajay = Greenfoot.getRandomNumber( 400 );
         addObject(new Caja(), cajax, cajay);
         addObject(new Salida(), 4200,470);
         addObject(new Puntos(), 100,40, false );
         addObject(new Door(), 4350,343);
         
         for( int i = 0; i<20; i++ ){
             int x = Greenfoot.getRandomNumber(8000);
             int y = Greenfoot.getRandomNumber(400);
             addObject(new Misil(), x, y);
         }
                    
         for(int i=0; i<40; i++){
             int x = Greenfoot.getRandomNumber(8000);
             int y = Greenfoot.getRandomNumber(400);
                         
             addObject(new Monedas() ,x,y);
                        
         }
                     
         for( int i = 0; i<20; i++ ){
             int x = Greenfoot.getRandomNumber(8000);
             int y = Greenfoot.getRandomNumber(400);
             int tipo = Greenfoot.getRandomNumber( 2 );
             if( tipo == 1 )
                addObject(new Obstaculo1(), x, y);
             else
                addObject( new Obstaculo2(), x, y);
         }
    }
    
    public void act()
    {
       super.act();
    }
}
